/**
 * Created by on 2018/5/4.
 */
define(function () {

    var self,
        app = win.app,
       orderSubmitArg


    var jzxx = app.Module.extend({

        init: function () {
            self = this;
            self._super({
                _tag: 'p_list', // key, 对象放进pageModule
                _refreshAutoInit: true //自动加载刷新控件
            }, win);
            orderSubmitArg = app.pageParameters['gwaq553jzxx_page'];
        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scroll1'];
            }
            this._super(win);
        },
        _refreshCb: function (goods) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: "api/wx/gwaq553/getJzxxPage",
                xdata: {
                    page:goods.page+1,
                    limit: goods.limit,
                    GWBJNAME:orderSubmitArg.GWBHNAME
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data;
                        goods.data.pushArray(data.data, goods.page == 0);

                        _super({
                            obj: goods,
                            dataLen: data.data.length,
                            nodata: '无竞争信息...'
                        });
                    }
                }
            });
        },
        _lazy: function () {
            this._super();
        },
        _ready: function () {


            Vue.component('jzxxitem', {
                template: app.getByid(doc, 'jzxxitem-template'),
                props: {
                    model: Array
                },
                methods: {
                    dj: function (v) {
                        if(v=="1"){
                            return "主要对手";

                        }else if(v=="2"){
                            return "重要对手";

                        }else if(v=="3"){
                            return "一般对手";

                        }else if(v=="4"){
                            return "其他对手";

                        }
                    }
                }
            });
        }
    });

    return new jzxx();

});